function m_paint4TimeFrequency4Single(ouRoot, S, freq, T, header, ff)
       [nFFT, L_SEG] = size(S);
       
       [XX, YY] = meshgrid(T, freq(1:nFFT));
       if length(T) < L_SEG
          S = S(:, 1:length(T));
       end
       [p_sdate, p_edate, xtick4Index, xtick4label] = calpaintsdate2edate(T);
       label = sprintf('%s-%s-%s-%s', header.STNM, header.EQID, datestr(p_sdate, 'yyyymmdd'), datestr(p_edate, 'yyyymmdd'));
       FileName = [ouRoot sprintf('%s.bmp', label)];
       %f = figure('visible', 'on');
       axis tight manual;
       subplot(3,1,[1 2])
       surf(XX, YY, 10*log10(abs(S)), 'lineStyle', 'none');
       title(label);
       xlim([p_sdate p_edate]);
       ylim([0 0.5]);
       %zlim([spID{2} spID{4}]);
       view([0 90]);
       set(gca, 'CLim', [-300 -50]);
       %xtick4Index = [1 : type : length(T)]
       
%        index = 1;
%        for i = 1 : length(xtick4Index)
%            xtl{i} = datestr(T(xtick4Index(i)), 'dd'); 
%            index = index + 1;
%        end
       set(gca, 'xtick', xtick4Index, 'xticklabel', xtick4label);
       set(gca, 'ytick', [0 : 0.1 : 0.5]);
       colormap(jet);
       c = colorbar('southoutside');
       set(c, 'YTick', [-300 : 50 : -50]);
       AA = 10*log10(abs(S));
       %ff = [0.04  0.08 0.12 0.16];
       [~, fi] = min(abs(ff - freq));
       subplot(3,1,3)
       Y = AA(fi, :);
       X = T;
       title(label);
       plot(X, Y);
       xlim([p_sdate p_edate]);
       ylim([-200 -100]);
       set(gca, 'xtick', xtick4Index, 'xticklabel', xtick4label);
       lg = [];
       for i = 1 : length(ff)
           lg{i} = sprintf('%4.2f', ff(i));
       end
       %legend(lg);
       drawnow;
%        F = getframe(f);
%        im= frame2im(F);
%        [imind, cm] = rgb2ind(im, 2^10);
%        imwrite(imind, cm, FileName,'bmp');
       saveas(gca, FileName);
       close all;
end
function [p_sdate, p_edate, xtick4Index, xtick4label] = calpaintsdate2edate(T)
   p_sdate = round(T(1));
   p_edate = round(T(end));
   xtick4Index = [p_sdate  : 3 : p_edate];
   N = length(xtick4Index);
   xtick4label = cell(N,1);
   for i = 1 : N
        xtick4label{i} = sprintf('%s', datestr(xtick4Index(i),'dd'));
   end
   
end